package com.cn.yang.servlet;

import com.cn.yang.service.ContactUsService;
import com.cn.yang.service.MainPageService;
import com.cn.yang.service.impl.ContactUsServiceImpl;
import com.cn.yang.service.impl.MainPageServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/contact us")
public class ContactUsServlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //获得headLink的List。
        MainPageService headLink = new MainPageServiceImpl();
        req.setAttribute("headLink",headLink.selectHeadLink());
        //获得头尾 存储的字段，
        MainPageService headFootService = new MainPageServiceImpl();
        req.setAttribute("headFootService",headFootService.selectHeadFoot());
        //====================================================================================
        ContactUsService service = new ContactUsServiceImpl();
        req.setAttribute("contactUs",service.findContactUs());
        
        req.getRequestDispatcher("/jsp/contact us.jsp").forward(req,resp);
    }
}
